package com.tedu.day4;

public class TestHanLuoTa {
    public static void main(String[] args) {
        char A = 'A';
        char B = 'B';
        char C = 'C';
        int n = 2;
        HanLuoTa(A, B, C,n);
    }
    public static void HanLuoTa(char a,char b,char c,int n){
        if(n == 1 ){
            moveHanLuoTa(a,c);

        }else{
            HanLuoTa(a, c, b, n-1);
            moveHanLuoTa( a, c);
            HanLuoTa(b,a,c,n-1);
        }

    }

    public static void moveHanLuoTa(char a,char c){
        System.out.println(a +"---->"+ c);
    }
}
